home *** CD-ROM | disk | FTP | other *** search
- /* file heartbeat.c
- shows heartbeat-like indicator in its area
- by LHL
- */
-
- #include "busybox.h"
-
- static int16 width, height, half;
- static Point whereLast; /* what the last point drawn was */
- Rect fooRect;
-
- void InitHeartBeatObj(Rect *drawArea, int16 ID)
- {
- fooRect = *drawArea;
- width = fooRect.right - fooRect.left;
- height = fooRect.bottom - fooRect.top;
- half = height / 2;
- SetRect(&fooRect, 0, 0, 500, 500);
-
- whereLast.h = 0;
- whereLast.v = half;
-
- } /* InitHeartBeatObj */
-
-
- void DrawHeartBeatObj(int16 ID)
- {
- static int16 delta_vert, time_in;
-
- MoveTo(whereLast.h, whereLast.v);
-
- switch (time_in) {
- case 1:
- whereLast.v = half;
- break;
- case 2:
- whereLast.v = whereLast.v - (half / 2);
- break;
- case 3:
- whereLast.v = whereLast.v + half;
- break;
- case 4:
- whereLast.v = whereLast.v - (half / 2);
- break;
- }
-
- if (++time_in > 4)
- time_in = 0;
-
- if ((whereLast.h = whereLast.h + 8) > width) {
- whereLast.h = 0;
- EraseRect(&fooRect);
- MoveTo(whereLast.h,whereLast.v);
- }
-
- LineTo(whereLast.h, whereLast.v);
-
- } /* DrawHeartBeatObj */
-